<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <input type="text" v-model="name">
    <HelloButton v-on:Helloyou="Hello"></HelloButton>
</div>

</body>
<script src='../lib/vue.js'></script>
<script>
    //$emit方法: 触发到父级元素的方法
    Vue.component('HelloButton', {
        props: ['name'],
        template: `
            <button v-on:click="$emit('Helloyou')">Hello</button>
        `
    })

    new Vue({
        el: '#app',
        data: {
            'name': '张业頔'
        },
        methods: {
            Hello: function (args) {
                alert('Hello ' + args)
            }
        }
    })

</script>
</html>